# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-ptp
pkgname=('python2-ptp' 'python-ptp')
_pkgname=PTP
pkgver=0.4.2
_pyver=3.13
pkgrel=13
pkgdesc='PTP parses and ranks the discoveries listed in security tool reports.'
url='https://pypi.org/project/PTP/#files'
license=('BSD')
arch=('any')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('eea093e5471784bccdfe461b206291dd60361cfd5b35af4224a5d9f3b3617f01359c4d2ca567b87242807a543c19036e52c759233c9349c6fcc571db022045d5')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-ptp() {
  depends=('python2' 'python2-lxml' 'python2-js2py')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python2.7/site-packages/tests"
}

package_python-ptp() {
  depends=('python' 'python-lxml' 'python-js2py')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/tests"
}

